/*
 * init.cpp
 *
 *  Created on: Jun 6, 2011
 *      Author: timothy
 */

#include "init.h"
#include <string.h>
#include <omp.h>

#include "debug.h"

arg_vars init_args(int argc, char **argv)
{
	arg_vars ret;
	if(argc != 5 && argc != 6)
	{
		printf("Expected Use: %s infile outfile c s\n   (c and s are integers, see documentation)\n", argv[0]);
		ret.success = 0;
		return ret;
	}
	try
	{
		strcpy(ret.infile_n, argv[1]);
		strcpy(ret.outfile_n, argv[2]);
		ret.num_trials = atoi(argv[3]);
		ret.shingle_length = atoi(argv[4]);
		if(argc == 6)
			omp_set_num_threads(atoi(argv[5]));
		ret.success = 1;
		pdprint(0, "%s, %s, %d, %d\n", ret.infile_n, ret.outfile_n, ret.num_trials, ret.shingle_length);
		return ret;
	}
	catch(...)
	{
		printf("Expected Use: %s infile outfile c s\n   (c and s are integers, see documentation)\n", argv[0]);
		ret.success = 0;
		return ret;
	}
}
